""""
创建字典
list的使用[]来进行列表创建
字典的使用{}来进行字典的创建
元组的使用()来进行元组的创建
"""
"花括号‘{}’创建字典"
empic_dict = {}
"创建一个包含三个元素的字典"
stu_dict = {"name":"YuChen","stu_id":"20240616","graade":"大三"}
"使用元组作为字典的键"
stu1_dict = {(20240616,"YuChen"):"大三",(20240616,"Nun"):"大三"}
"使用dict()函数创建字典"
empic_dict = dict()
"使用dict()将二元组列表转化字典"
stu_list = {("name","YuChen"),("stu_id","20240616"),("graade","大三")}
stu_dict = dict(stu_list)
print(stu_dict)
"通过在dict()中设置关键字创建参数字典"
stu2_dict = dict(name="YuChen",stu_id="20240616",graade="大三")
print(stu2_dict)
